<%--
功能：规格显示
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ tag import="org.springframework.context.ApplicationContext" %>
<%@ tag import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ tag import="com.probiz.estore.product.service.SkuOptionValueManager" %>
<%@ attribute name="skuOptionValue" type="com.probiz.estore.common.model.product.SkuOptionValue" required="false" description="规格值"%>
<%@ attribute name="skuOptionValueId" type="java.lang.Integer" required="false" description="id 如果skuOptionValue 无指定,则必须指定skuOptionValueId"%>
<%@ attribute name="selected" type="java.lang.Boolean" required="false" description="是否选中"%>
<%@ attribute name="url" type="java.lang.String" required="false" description="超链接"%>
<%@ attribute name="id" type="java.lang.String" required="false" description="id"%>
<%@ attribute name="otherAttrs" type="java.lang.String" required="false" description="其他属性"%>


<%
	ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
	SkuOptionValueManager skuOptionValueManager = (SkuOptionValueManager) ctx.getBean("skuOptionValueManager");
	if(skuOptionValue == null){
		skuOptionValue = skuOptionValueManager.getById(skuOptionValueId);
	}
	jspContext.setAttribute("skuOptionValue",skuOptionValue);
%>

<c:choose>
	<c:when test="${skuOptionValue.skuOptionValueType == 1}">
		<li  <c:if test="${not empty id}">id="${id}"</c:if> ${otherAttrs}
			 class="txt ${selected?'curr':''}"><a href="${(not empty url)?url:'javascript:void(0)'}" title="${skuOptionValue.skuOptionValue}"><span class="c">${skuOptionValue.skuOptionValueName}</span></a>
			<c:if test="${selected}"><i></i></c:if>
		</li>
	</c:when>
	<c:when test="${skuOptionValue.skuOptionValueType == 2}">
		<li  <c:if test="${not empty id}">id="${id}"</c:if> ${otherAttrs}
			class="img ${selected?'curr':''}"><a href="${(not empty url)?url:'javascript:void(0)'}" style="background-color:#${skuOptionValue.skuOptionValue}" title="${skuOptionValue.skuOptionValueName}"><span class="c">${skuOptionValue.skuOptionValueName}</span></a>
			<c:if test="${selected}"><i></i></c:if>
		</li>
	</c:when>
	<c:when test="${skuOptionValue.skuOptionValueType == 3}">
		<li <c:if test="${not empty id}">id="${id}"</c:if> ${otherAttrs}
			class="img ${selected?'curr':''}"><a href="${(not empty url)?url:'javascript:void(0)'}" style="background-image:url(${mediaPath}${skuOptionValue.skuOptionValue})" title="${skuOptionValue.skuOptionValueName}"><span class="c">${skuOptionValue.skuOptionValueName}</span></a>
			<c:if test="${selected}"><i></i></c:if>
		</li>
	</c:when>
	<c:otherwise>
	</c:otherwise>
</c:choose>